<template>
  <!-- 纳新报名 -->
  <div class="app-container">
    <!--  搜索框 开始  -->
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="志愿" prop="applyFirst">
        <el-input
          v-model="queryParams.applyFirst"
          placeholder="请输入志愿"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学期" prop="orgName">
        <el-select v-model="queryParams.schoolYear" placeholder="请选择学期">
          <el-option
            v-for="option in schoolYears"
            :key="option.schoolYearId"
            :label="option.schoolYearId"
            :value="option.schoolYearId"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="学号" prop="applyStuid">
        <el-input
          v-model="queryParams.applyStuid"
          placeholder="请输入学号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
          <el-option
            v-for="dict in dict.type.sys_apply_state"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!--  搜索框 结束  -->

    <!--  操作按钮 开始  -->
    <el-row :gutter="10" class="mb8">
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="primary"-->
      <!--          icon="el-icon-plus"-->
      <!--          size="small"-->
      <!--          @click="handleAdd"-->
      <!--          v-hasPermi="['hd:apply:add']"-->
      <!--        >新增</el-button>-->
      <!--      </el-col>-->
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="success"-->
      <!--          plain-->
      <!--          icon="el-icon-edit"-->
      <!--          size="mini"-->
      <!--          :disabled="single"-->
      <!--          @click="handleUpdate"-->
      <!--          v-hasPermi="['hd:apply:edit']"-->
      <!--        >修改</el-button>-->
      <!--      </el-col>-->
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="danger"-->
      <!--          plain-->
      <!--          icon="el-icon-delete"-->
      <!--          size="mini"-->
      <!--          :disabled="multiple"-->
      <!--          @click="handleDelete"-->
      <!--          v-hasPermi="['hd:apply:remove']"-->
      <!--        >删除</el-button>-->
      <!--      </el-col>-->

      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="small"
          @click="handleBatchProcessing"
          v-hasPermi="['hd:apply:batchProcessing']"
          >批量处理</el-button
        >
      </el-col>
      <!----------------------------------------------->
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="success"-->
      <!--          icon="el-icon-search"-->
      <!--          @click="auditServer()"-->
      <!--          :disabled="this.sels.length === 0"-->
      <!--        >批量审核</el-button>-->

      <!--        <el-button @click="toggleSelection()">取消选择</el-button>-->
      <!--      </el-col>-->
      <!----------------------------------------------->

      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="small"
          @click="handleExport"
          v-hasPermi="['hd:apply:export']"
          >导出</el-button
        >
      </el-col>

      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!--  操作按钮 结束  -->

    <!----------------------------------------------->
    <!--    <el-table border :fit="true" ref="multipleTable" height="520" :data="listData" :highlight-current-row="true" size="small" @selection-change="selsChange" @row-click="handleChange">-->
    <!--      <el-table-column type="selection" width="55"></el-table-column>-->
    <!--      <el-table-column prop="applcd" label="微服务编码" show-overflow-tooltip width="130px" sortable fixed="left"></el-table-column>-->
    <!--      <el-table-column prop="servcd" label="服务编码" show-overflow-tooltip width="130px" sortable fixed="left"></el-table-column>-->
    <!--    </el-table>-->
    <!----------------------------------------------->

    <!--  表格  开始  -->
    <el-table
      v-loading="loading"
      border
      :data="applyList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <!--      <el-table-column label="编号" align="center" prop="id" />-->
      <el-table-column label="组织名称" align="center" prop="orgName" />
      <el-table-column label="指导单位" align="center" prop="units" />
      <el-table-column label="姓名/学号/系部" align="center" prop="applyName">
        <template slot-scope="scope">
          {{ scope.row.applyName }} {{ scope.row.applyStuid }}<br />{{ scope.row.applyDept }}
        </template>
      </el-table-column>
      <!-- <el-table-column label="学号" align="center" prop="applyStuid" /> -->
      <el-table-column label="第一志愿" align="center" prop="applyFirst" />
      <el-table-column label="第二志愿" align="center" prop="applySecond" />
      <el-table-column label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_apply_state" :value="scope.row.status" />
        </template>
      </el-table-column>
      <el-table-column label="微信激活" align="center" prop="isActivateWechat">
        <template slot-scope="scope">
          {{ scope.row.isActivateWechat == 1 ? '已激活' : '未激活' }}
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        align="center"
        width="380px;"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-edit"-->
          <!--            @click="handleUpdate(scope.row)"-->
          <!--            v-hasPermi="['hd:apply:edit']"-->
          <!--          >修改</el-button>-->

          <el-button
            size="small"
            type="primary"
            icon="el-icon-view"
            @click="handleUpdate(scope.row)"
            >查看</el-button
          >
          <!-- v-hasPermi="['hd:apply:edit']" -->
          <!-- <el-button
            size="small"
            type="primary"
            icon="el-icon-edit-outline"
            @click="handleAudit(scope.row)"
            v-hasPermi="['hd:apply:audit']"
          >审核</el-button> -->
          <el-button
            size="small"
            type="primary"
            icon="el-icon-message"
            v-hasPermi="['hd:apply:sendMsg1']"
            @click="submitSendMsgDialog(scope.row, 1)"
            >面试通知</el-button
          >
          <el-button
            size="small"
            type="primary"
            icon="el-icon-position"
            v-hasPermi="['hd:apply:sendMsg2']"
            @click="submitSendMsgDialog(scope.row, 2)"
            >任命通知</el-button
          >
          <el-button
            size="small"
            type="danger"
            v-hasPermi="['hd:apply:sendMsg3']"
            @click="submitSendMsgDialog(scope.row, 3)"
            >不通过</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['hd:apply:remove']"
            >删除</el-button
          >
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['hd:apply:remove']"-->
          <!--          >审核</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!--  表格  结束  -->

    <!-- 添加或修改纳新报名对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名">
              <!--          <el-input v-model="form.applyName" placeholder="请输入姓名" disabled />-->
              <div>{{ form.applyName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学号">
              <!--          <el-input v-model="form.applyStuid" placeholder="请输入学号" disabled />-->
              <div>{{ form.applyStuid }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="系部">
              <!--          <el-input v-model="form.applyDept" placeholder="请输入系部" disabled />-->
              <div>{{ form.applyDept }}</div>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="专业">
              <div>{{form.applyProf}}</div>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="手机号">
              <!--          <el-input v-model="form.applyPhone" placeholder="请输入手机号" disabled />-->
              <div>{{ form.applyPhone }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="QQ号">
              <!--          <el-input v-model="form.applyQrcode" placeholder="请输入QQ号" disabled />-->
              <div>{{ form.applyQrcode }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="第一志愿">
              <!--          <el-input v-model="form.applyFirst" placeholder="请输入第一志愿" disabled />-->
              <div>{{ form.applyFirst }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="第二志愿">
              <!--          <el-input v-model="form.applySecond" placeholder="请输入第二志愿" disabled />-->
              <div>{{ form.applySecond }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否服从调剂">
              <!--          <el-select v-model="form.applyAdjust" placeholder="请输入是否服从调剂" disabled>-->
              <!--            <el-option label="是" value="1"/>-->
              <!--            <el-option label="否" value="2"/>-->
              <!--          </el-select>-->
              <div>{{ form.applyAdjust == 1 ? '是' : '否' }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="个人特长">
              <!--          <el-input v-model="form.applySpecialty" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form.applySpecialty }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="相关工作经历">
              <!--          <el-input v-model="form.applyWorkexperience" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form.applyWorkexperience }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="个人荣誉">
              <!--          <el-input v-model="form.applyHonor" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form.applyHonor }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="其他说明">
              <!--          <el-input v-model="form.applyOther" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form.applyOther }}</div>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <!--        <el-button type="primary" @click="submitForm">修 改</el-button>-->
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 审核对话框 -->
    <el-dialog :title="title1" :visible.sync="open1" width="800px" append-to-body>
      <el-form ref="form1" :model="form1" :rules="rules" label-width="120px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名">
              <!--          <el-input v-model="form.applyName" placeholder="请输入姓名" disabled />-->
              <div>{{ form1.applyName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学号">
              <!--          <el-input v-model="form.applyStuid" placeholder="请输入学号" disabled />-->
              <div>{{ form1.applyStuid }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="系部">
              <!--          <el-input v-model="form.applyDept" placeholder="请输入系部" disabled />-->
              <div>{{ form1.applyDept }}</div>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="专业">
              <div>{{form1.applyProf}}</div>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="手机号">
              <!--          <el-input v-model="form.applyPhone" placeholder="请输入手机号" disabled />-->
              <div>{{ form1.applyPhone }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="QQ号">
              <!--          <el-input v-model="form.applyQrcode" placeholder="请输入QQ号" disabled />-->
              <div>{{ form1.applyQrcode }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="第一志愿">
              <!--          <el-input v-model="form.applyFirst" placeholder="请输入第一志愿" disabled />-->
              <div>{{ form1.applyFirst }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="第二志愿">
              <!--          <el-input v-model="form.applySecond" placeholder="请输入第二志愿" disabled />-->
              <div>{{ form1.applySecond }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否服从调剂">
              <!--          <el-select v-model="form.applyAdjust" placeholder="请输入是否服从调剂" disabled>-->
              <!--            <el-option label="是" value="1"/>-->
              <!--            <el-option label="否" value="2"/>-->
              <!--          </el-select>-->
              <div>{{ form1.applyAdjust == 1 ? '是' : '否' }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="个人特长">
              <!--          <el-input v-model="form.applySpecialty" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form1.applySpecialty }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="相关工作经历">
              <!--          <el-input v-model="form.applyWorkexperience" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form1.applyWorkexperience }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="个人荣誉">
              <!--          <el-input v-model="form.applyHonor" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form1.applyHonor }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="其他说明">
              <!--          <el-input v-model="form.applyOther" type="textarea" placeholder="请输入内容" disabled />-->
              <div>{{ form1.applyOther }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="审核结果" prop="audit">
              <el-select v-model="form1.checks" placeholder="请选择审核结果">
                <el-option label="申请通过" value="1" />
                <el-option label="申请拒绝" value="2" />
                <el-option label="下一轮面试" value="3" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm1">确 定</el-button>
        <el-button @click="cancel1">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 批量处理对话框 -->
    <el-dialog :title="title2" :visible.sync="open2" width="800px" append-to-body>
      <el-form ref="form2" :model="form2" :rules="rules" label-width="120px">
        <el-form-item label="姓名">
          <span v-for="(dict, index) in ids" :key="index">{{ dict.applyName }} </span>
        </el-form-item>

        <el-row>
          <el-form-item label="通知类型" prop="typeVal">
            <el-select v-model="form2.typeVal" placeholder="请选择" style="width: 120px">
              <el-option label="面试通知" value="1" />
              <el-option label="任命通知" value="2" v-hasPermi="['hd:apply:sendMsg2']" />
              <el-option label="不通过通知" value="3" />
            </el-select>
          </el-form-item>
        <el-form-item v-if="form2.typeVal == 2" label="任命职位" prop="position">
          <el-input v-model="form2.position" placeholder="请输入职位" style="width: 25%" />
        </el-form-item>
          <el-form-item label="通知内容"  prop="value">
            <el-input
              v-model="form2.value"
              type="textarea"
              placeholder="请输入内容"
              :autosize="{ minRows: 2, maxRows: 4 }"
              style="width: 80%"
            >
            </el-input>
          </el-form-item>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm2">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 发送通知弹框 -->
    <el-dialog :title="title" :visible.sync="sendMsgdialog" width="600px" append-to-body>
      <el-form ref="form3" :model="form3" :rules="rules" label-width="120px">
        <el-row>
          <el-form-item v-if="form3.type == 2" label="任命职位" prop="position">
            <el-input v-model="form3.position" placeholder="请输入职位" style="width: 25%" />
          </el-form-item>
          <el-form-item label="通知内容" prop="value">
            <el-input
              v-model="form3.value"
              type="textarea"
              placeholder="请输入内容"
              :autosize="{ minRows: 2, maxRows: 4 }"
              style="width: 80%"
            >
            </el-input>
          </el-form-item>
        </el-row>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitSendMsg">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listApply,
  getApply,
  delApply,
  addApply,
  updateApply,
  updateStatus,
  GetYearList,
  sendMsg,
} from '@/api/hd/apply';
import { getToken } from '@/utils/auth';

export default {
  name: 'Apply',
  dicts: ['sys_apply_state'],
  data() {
    return {
      // 学期选项
      schoolYears: [],
      AdjustOption: [
        {
          num: 1,
          view: '是',
        },
        {
          num: 2,
          view: '否',
        },
      ],
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 纳新报名表格数据
      applyList: [],
      // 弹出层标题
      title: '',
      title1: '',
      title2: '',
      // 是否显示弹出层
      open: false,
      open1: false,
      open2: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        applyName: null,
        applyStuid: null,
        status: null,
      },
      // 表单参数
      form: {},
      form1: {
        id: '',
        checks: '',
      },
      form2: {
        id: '',
        typeVal: '',
        value: '',
      },
      // 表单校验
      rules: {
        applyName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
        applyStuid: [{ required: true, message: '学号不能为空', trigger: 'blur' }],
        applyDept: [{ required: true, message: '系部不能为空', trigger: 'blur' }],
        applyProf: [{ required: true, message: '专业不能为空', trigger: 'blur' }],
        applyPhone: [{ required: true, message: '手机号不能为空', trigger: 'blur' }],
        applyQrcode: [{ required: true, message: 'QQ号不能为空', trigger: 'blur' }],
        applyFirst: [{ required: true, message: '第一志愿不能为空', trigger: 'blur' }],
        applySecond: [{ required: true, message: '第二志愿不能为空', trigger: 'blur' }],
        applyAdjust: [{ required: true, message: '是否服从调剂不能为空', trigger: 'blur' }],
        applySpecialty: [{ required: true, message: '个人特长不能为空', trigger: 'blur' }],
        typeVal: [{ required: true, message: '通知类型不能为空', trigger: 'blur' }],
        value: [{ required: true, message: '通知内容不能为空', trigger: 'blur' }],
        position: [{ required: true, message: '任命职位不能为空', trigger: 'blur' }],
        // audit: [
        //   { required: true, message: "审核结果不能为空", trigger: "blur" }
        // ]
      },
      sendMsgdialog: false,
      form3: {},
    };
  },
  created() {
    GetYearList().then(response => {
      console.log(response, 'Years');
      this.schoolYears = response.rows;
    });
    this.getList();
  },
  methods: {
    /** 查询纳新报名列表 */
    getList() {
      this.loading = true;
      listApply(this.queryParams).then(response => {
        this.applyList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel1() {
      this.open1 = false;
      this.reset();
      this.getList();
    },
    cancel2() {
      this.open2 = false;
      this.sendMsgdialog = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        applyName: null,
        applyStuid: null,
        applyDept: null,
        applyProf: null,
        applyPhone: null,
        applyQrcode: null,
        applyFirst: null,
        applySecond: null,
        applyAdjust: null,
        applySpecialty: null,
        applyWorkexperience: null,
        applyHonor: null,
        applyOther: null,
        status: '0',
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
      };
      this.resetForm('form');
      this.resetForm('form3');
    },
    reset1() {
      this.form1 = {
        id: null,
        checks: null,
      };
      this.resetForm('form1');
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm');
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = '添加纳新报名';
    },
    /** 批量处理按钮操作 */
    handleBatchProcessing() {
      if (this.ids.length > 0) {
        this.reset();
        this.open2 = true;
        this.title2 = '纳新批量处理';
      } else {
        this.$modal.msgError('请选择数据！');
      }
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getApply(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = '查看纳新报名';
      });
    },
    submitSendMsgDialog(row, typeVal) {
      var type = 0;
      if (row.status == '0' && typeVal == 1) {
        type == 0;
      } else {
        type = typeVal;
      }
      var sendVal =
        type == 0
          ? '发送首次面试通知！'
          : type == 1
          ? '发送面试通知！'
          : type == 2
          ? '发送任命通知！'
          : '不通过！';
      console.log(sendVal, type, 'aaa');
      this.form3 = { ...row };
      this.form3.type = type;
      this.title = '对' + row.applyName + sendVal;
      this.sendMsgdialog = true;
    },

    /** 通知操作 */
    submitSendMsg() {
      // var type = 0;
      // if (row.status == '0' && typeVal == 1) {
      //   type == 0;
      // } else {
      //   type = typeVal;
      // }
      // var sendVal =
      //   type == 0
      //     ? '发送首次面试通知！'
      //     : type == 1
      //     ? '发送面试通知！'
      //     : type == 2
      //     ? '发送任命通知！'
      //     : '不通过！';
      // console.log(sendVal, type, 'aaa');
      // this.$prompt('对' + row.applyName + sendVal, '提示', {
      //   inputType: 'textarea',
      //   confirmButtonText: '确定',
      //   cancelButtonText: '取消',
      //   inputErrorMessage: '输入不能为空',
      //   inputValidator: value => {
      //     if (!value) {
      //       return '输入不能为空';
      //     }
      //   },
      // })
      //   .then(({ value }) => {

      this.$refs['form3'].validate(valid => {
        if (valid) {
          var position = this.form3.type == 2 ? this.form3.position : '0';
          sendMsg(this.form3.type, this.form3.id, this.form3.value, position).then(res => {
            if (res.code == 200) {
              this.getList();
              this.$modal.msgSuccess('操作成功');
              this.sendMsgdialog = false;
            }
          });
        }
      });
      // })
      // .catch(() => {
      //   this.$message({
      //     type: 'info',
      //     message: '取消输入',
      //   });
      // });
    },

    /** 2.修改提交 */
    submitForm2() {
      this.$refs['form2'].validate(valid => {
        if (valid) {
          for (let i = 0; i < this.ids.length; i++) {
            var row = this.ids[i];
            var typeVal = this.form2.typeVal;
            var value = this.form2.value;
            var type = 0;
            if (row.status == '0' && typeVal == 1) {
              type == 0;
            } else {
              type = typeVal;
            }
            // const optionIds = row.optionId || this.ids;
            this.$confirm('确定发送通知？', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning',
            })
              .then(() => {
                sendMsg(type, row.id, value, '0').then(res => {
                  if (res.code == 200) {
                    this.getList();
                    this.$modal.msgSuccess('操作成功');
                  }
                });
              })
              .catch(() => {
                this.$message({
                  type: 'info',
                  message: '取消输入',
                });
              });
          }
        }
      });
    },
    /** 审核按钮操作 */
    handleAudit(row) {
      this.reset1();
      // const id = row.id || this.ids
      // getApply(id).then(response => {
      //   this.form = response.data;
      //   this.open1 = true;
      //   this.title1 = "报名审核";
      // });
      this.form1 = row;
      this.open1 = true;
      this.title1 = '报名审核';
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateApply(this.form).then(response => {
              if (response.code == 200) {
                this.$modal.msgSuccess('修改成功');
                this.open = false;
                this.getList();
              }
            });
          } else {
            addApply(this.form).then(response => {
              if (response.code == 200) {
                this.$modal.msgSuccess('新增成功');
                this.open = false;
                this.getList();
              }
            });
          }
        }
      });
    },
    /** 申请提交按钮 */
    submitForm1() {
      this.$refs['form1'].validate(valid => {
        if (valid) {
          if (this.form1.checks != null) {
            updateStatus(this.form1.id, this.form1.checks).then(response => {
              if (response.code == 200) {
                this.$modal.msgSuccess('审核成功');
                this.open1 = false;
                this.getList();
              }
            });
          } else {
            this.$modal.msgWarning('审核结果不能为空');
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id;
      this.$modal
        .confirm('是否确认删除纳新报名编号为"' + ids + '"的数据项？')
        .then(function () {
          return delApply(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess('删除成功');
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        'hd/apply/export',
        {
          ...this.queryParams,
        },
        `apply_${new Date().getTime()}.xlsx`
      );
    },
    // --------------------------------------------------
    //   selsChange(sels) {
    //     this.sels = sels
    //   },
    //
    //   handleChange(row, event, column) {
    //     this.$refs.multipleTable.toggleRowSelection(row)
    //   },
    //   auditServer () {
    //     var servids = this.sels.map(item => item.servid).join(",")
    //     var params = {
    //       serverIds:servids
    //     }
    //     debugger
    //     auditServer(params).then(
    //       function (res) {
    //         debugger
    //         if(res.code === 200){
    //           this.$message({
    //             message: res.data,
    //             type: 'success'
    //           })
    //           this.dialogFormVisible = false
    //         }else{
    //           this.$message({
    //             message: '错误信息：'+res.message,
    //             type: 'error'
    //           });
    //         }
    //         this.loadData()
    //       }.bind(this)
    //     )
    //   },
    //
    //   toggleSelection(){
    //     this.$refs.multipleTable.clearSelection();
    //   }
    // --------------------------------------------------
  },
};
</script>

<style scoped>
el-textarea__inner {
  height: 150px;
  overflow-y: auto;
}
</style>
